package com.cloud.pages;

import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;

import static org.openqa.selenium.support.ui.ExpectedConditions.presenceOfElementLocated;

public class MainPage extends AnyPage {


    //Constructor
    public MainPage(PageManager pages) {
        super(pages);
    }


    //Page elements
    @FindBy()
    private WebElement element;


    //Methods
    public MainPage ensurePageLoaded() {
        wait.until(presenceOfElementLocated(By.cssSelector("nav")));
        return this;
    }

    public boolean isLoaded() {
        try {
            wait.until(presenceOfElementLocated(By.id("loginform")));
            return true;
        } catch (Exception e) {
            return false;
        }
    }


}
